#ifndef _DevicesBuzz_H_
#define _DevicesBuzz_H_


typedef enum {
    BUZZ_IDLE                    = 0,
    BUZZ_DISABLE,                /* 关闭 */
    BUZZ_ENABLE,                 /* 常亮 */
    BUZZ_FLASH_SLOW,             /* 循环慢闪（0.5Hz） */
    BUZZ_FLASH_SLOW_ENABLE_CNT,  /* 慢闪N次后BUZZ常亮 */
    BUZZ_FLASH_SLOW_DISABLE_CNT, /* 慢闪N次后BUZZ关闭 */
    BUZZ_FLASH_FAST,             /* 循环快闪（1Hz） */
    BUZZ_FLASH_FAST_ENABLE_CNT,  /* 快闪N次后BUZZ常亮 */
    BUZZ_FLASH_FAST_DISABLE_CNT, /* 快闪N次后BUZZ关闭 */
    BUZZ_BREATHE,                /* 呼吸 */
    BUZZ_DUTY,                   /* 固定占空比 */
}BuzzStateEnum;


typedef struct{
    BuzzStateEnum state; /* 状态 */
    int8_t flashCnt;     /* 闪烁次数 */

    GPIO_Module *periph;
    uint16_t pin;
}BuzzInfoType;



#define BUZZ_GPIO_Port   GPIOA
#define BUZZ_Pin         GPIO_PIN_6


#define BUZZ_OPEN()  GPIO_SetBits(BUZZ_GPIO_Port, BUZZ_Pin)
#define BUZZ_CLOSE() GPIO_ResetBits(BUZZ_GPIO_Port, BUZZ_Pin)


void vBuzzInit(void);
void vBuzzSetStatus(BuzzStateEnum enumStatus, uint8_t ucCnt);
void vBuzzStateMachine(BuzzInfoType *ptypeBuzz);
void vBuzzMachine(void);
BuzzInfoType *ptypeBuzzGetInfo(void);

#endif
